import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Random;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.DateTickUnit;
import org.jfree.chart.labels.StandardPieSectionLabelGenerator;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.time.Month;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.mybeans.dao.DAOException;

import edu.cmu.ibill.model.*;
import edu.cmu.ibill.databeans.*;

public class test {
	
	static SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");

	public static void main(String[] args) {

		try {
			PersonalBillDAO pdao = new PersonalBillDAO("org.postgresql.Driver",
					"jdbc:postgresql://localhost:5432/webapp", "postgres",
					"notmysql");
			
			
			int i=0;
			
			Random r = new Random();
			
			while(i<500){
				i++;
				
				PersonalBill pb = new PersonalBill();
				
				pb.setAmount(r.nextInt(100));
				
				pb.setCategoryId(r.nextInt(22));
				
				pb.setUserId(1);
				
				Date date = new Date();
				date.setDate(r.nextInt(28));
				date.setMonth(r.nextInt(10)+1);
				
				pb.setDate(new java.sql.Date(format.parse(format.format(date)).getTime()));
				
				pdao.create(pb);
				
			}
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		} catch (DAOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
